package com.alibaba.csp.sentinel.qlearning;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author zhangxp207
 * @version 1.0
 * @description: 存储了当前批次在执行action前的state,action,utility的信息
 * @date 2022/10/16 23:13
 */
public class QInfo {

    String state;
    AtomicInteger action = new AtomicInteger(0);
    volatile double utility;

    public String getState() {
        return this.state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public int getAction() {
        return action.get();
    }

    public void setAction(int action) {
        this.action.set(action);
    }

    public double getUtility() {
        return utility;
    }

    public synchronized void setQInfo(String state, int action, double utility) {
        this.state = state;
        this.action.set(action);
        this.utility = utility;
    }

}
